package com.zs.backend.modules;


import com.zs.backend.common.api.CommonResult;
import com.zs.backend.common.service.OSSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private OSSService ossService;

    @GetMapping("/test/{id}")
    public CommonResult queryLog(
        @PathVariable Long id) {
        return CommonResult.success(id);
    }

//    @PostMapping("/upload")
//    public CommonResult uploadFile(@RequestParam("file") MultipartFile file){
//        String fileUrl = ossService.upload(file);
//        return CommonResult.success(fileUrl);
//    }

    @GetMapping("/delete/{filePath}")
    public CommonResult deleteFile(@PathVariable String filePath){
        ossService.deleteFile(filePath);
        return CommonResult.success(true);
    }

}

